import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-07-23
 * Time: 22:48
 */
public class test1 {
    public static void main(String[] args) {

    }

    public static int subArr(int[] nums,int k){
        int sum =0,ret = 0;
        Map<Integer,Integer> map = new HashMap<>();
        map.put(0,1);
        for(int num:nums){
            sum += num;
            ret += map.getOrDefault(sum-k,0);
            map.put(sum,map.getOrDefault(sum,0)+1);
        }
        return ret;
    }
}
